package asinoai.UTemplates.Configuration.DAL.HibernateImplementation;

import java.util.List;

import asinoai.UTemplates.Configuration.DAL.SystemDAO;
import asinoai.UTemplates.Configuration.Model.System;
import asinoai.UTemplates.DALUtils.HibernateImplementation.HibernateDAOManagerBase;
import asinoai.UTemplates.DALUtils.HibernateImplementation.HibernateDataAccessObject;

public class HibernateSystemDAO extends HibernateDataAccessObject<System, Long> implements SystemDAO{

	public HibernateSystemDAO(HibernateDAOManagerBase manager) {
		super(manager, System.class);
	}

	@Override
	public System getSingleElement() {
		System result;
		try {
			final List<System> list = getAll();
			result = (list.size() == 0) ? null : list.get(0);
		} catch (Exception e) {
			result = null;
		}
		
		return result;
	}
}

